package com.runrunfast.face.controller;

import com.alibaba.fastjson.JSONObject;
import com.runrunfast.face.service.PersonService;
import com.runrunfast.face.service.common.YoutuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;

/**
 * 人员信息（person/face）Controller
 *
 * @author YangNing
 */
@Api(description = "人员信息")
@RestController
public class PersonController {
    private static Logger logger = LoggerFactory.getLogger(PersonController.class);

    @Autowired
    RestTemplate restTemplate;
    @Autowired
    YoutuService youtuService;
    @Autowired
    PersonService personService;

    @ApiOperation("上传人脸图片到指定人脸库")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "phone", paramType = "query", dataType = "String", value = "手机号", required = true, defaultValue = "13530702131"),
            @ApiImplicitParam(name = "faceGroupId", paramType = "query", value = "人脸库id", required = true, defaultValue = "10132073")
    })
    @PostMapping("/addPersonFace")
    public JSONObject addPersonFace(String phone, Integer faceGroupId, MultipartFile file) {
        return personService.addPersonFaceToFaceGroup(phone, faceGroupId, file);
    }
}
